home *** CD-ROM | disk | FTP | other *** search
- Docs for PSEND.COM and PTEST.COM - send printer codes from ascii files
- R. Trevithick, 09/29/87
-
-
- PSEND.COM
- =========
-
- This is a simple little utility which reads printer control codes from an
- ascii text file and sends them to the default printer.
-
- The syntax is:
-
- PSEND [d:][path]filename.ext
-
-
- The program aborts on any error, including printer not ready, and returns
- immediately to DOS with errorlevel 1 set. It produces no messages on
- screen. The idea was to keep it small and fast.
-
- The ascii text files are created with a text editor (in pure ascii mode) or
- with the DOS 'copy con' command.
-
- The codes must be entered as base 10 numeric values in the range of 0..255,
- and must be surrounded by brackets <>. Brackets cannot appear in the file
- EXCEPT when surrounding the codes.
-
- There are no other formatting requirements beyond the fact that the file
- cannot be larger than 32766 bytes. Hence, you can put comments and so on
- in the files to remind you what the codes do.
-
- Example:
-
- To send an escape, followed by an uppercase 'A' and a zero byte:
-
- <27><65><0>
-
- To send a formfeed:
-
- <13><10><12>
-
- Note that many printers won't process the formfeed character <12> unless
- it's paired with a carriage return <13> and linefeed <10> sequence.
-
-
- An example of a typical batch file to send some printer codes and run an
- application:
-
- psend custom.prn
- if errorlevel 1 goto ABORT
- dbase myprog
- goto END
- :ABORT
- echo ---ERROR --- printer setup failed!
- :END
-
- This would attempt to send the codes contained in the file 'custom.prn' to
- the printer. If there were any errors, we'd skip the program and go to the
- abort message. If the setup succeeded, dBase would be run with the
- argument 'myprog'.
-
-
-
- PTEST.COM
- =========
-
- PTEST is a program to assist in debugging the code files you'll be using
- with PSEND. It's run with the same syntax, and differs only in that it
- displays diagnostic messages when run.
-
- The PTEST program will display the codes on the screen, flagging any which
- contain errors, and send the valid ones out to the printer. If the printer
- isn't ready, the codes will just be displayed on the screen, and you'll get
- a message about the printer not accepting characters.
-
- Assuming the printer was on-line, you could then send some text to it to
- find out what effect your codes had. For example, to test the file
- 'test.prn':
-
- PTEST test.prn
-
-
- Any invalid codes will appear as '<L>' or '<V>', to avoid dumping
- screenloads of garbage to the display in certain types of error situations.
- The <L>ength message means you have either less than 1 or more than 3
- characters inside a set of brackets. The <V>alue message means you either
- have a non-numeric character or a number which cannot fit into a single
- byte (the 0..255 8-bit ascii range).
-
-
- For example, if your printer code file had this in it:
-
- <13><10><999><30><X><20><1234><12><5H>
-
- you would see this when you ran PTEST against it:
-
- 13 10 999-<V> 30 <V> 20 123-<L> 12 5-<V>
- errors found in codes!
-
-
- The program displays the codes as it finds them, from left to right. It
- continues displaying each character of a given code until it hits the
- end-of-code character '>' or until it detects any error condition.
-
- In the above example, the 13, 10, 30, 20 and 12 values display normally, as
- they should. The '999' is comprised of valid characters, so they are
- shown. When PTEST converts this set of characters to a numeric byte value
- in preparation for sending it to the printer, however, an overflow occurs,
- so it tags the <V>alue error message onto the end of the displayed code.
-
- The 'X' character is immediately recognized as invalid, so it is simply
- thrown away and again the <V>alue error is displayed. The fact that it
- isn't connected with a dash to the previous code tells you that it
- represents a code which wasn't displayable at all. The '1234' code is ok
- through the 3rd character, but when the 4th is hit PTEST tags it as a
- <L>ength error (too many characters). The last code is ok in the 1st
- position, so the '5' is shown. The illegal 'H' character, however, causes
- a <V>alue error to occur.
-
- There are a couple of points worth noting about all of this. The first is
- that ONLY valid characters are displayed by PTEST. It stops processing a
- code as soon as it hits any kind of error. If the error is in the 1st
- character position, there isn't anything to display.
-
- The second point you should note is the use of the dashes. When part of a
- code has been displayed, any error that occurs will be shown as connected,
- with a dash, to the code being processed. If the code is found to be
- invalid in the very first character and can't be displayed at all, the
- error message will appear alone without the dash.
-
-
- Bob Trevithick GEnie address: R.TREVITHICK
- Information Services Department
- Newark DDSO
- 703 E. Maple Ave
- Newark, NY 14513
-
- Voice: (315) 331-1700
-
-